package com.ruoyi.mall.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.MallTimeBannerMapper;
import com.ruoyi.mall.domain.MallTimeBanner;
import com.ruoyi.mall.service.IMallTimeBannerService;

/**
 * 抢购轮播图Service业务层处理
 *
 * @author ruoyi
 * @date 2022-02-24
 */
@Service
public class MallTimeBannerServiceImpl implements IMallTimeBannerService
{
    @Autowired
    private MallTimeBannerMapper mallTimeBannerMapper;

    /**
     * 查询抢购轮播图
     *
     * @param id 抢购轮播图主键
     * @return 抢购轮播图
     */
    @Override
    public MallTimeBanner selectMallTimeBannerById(Long id)
    {
        return mallTimeBannerMapper.selectMallTimeBannerById(id);
    }

    /**
     * 查询抢购轮播图列表
     *
     * @param mallTimeBanner 抢购轮播图
     * @return 抢购轮播图
     */
    @Override
    public List<MallTimeBanner> selectMallTimeBannerList(MallTimeBanner mallTimeBanner)
    {
        return mallTimeBannerMapper.selectMallTimeBannerList(mallTimeBanner);
    }

    /**
     * 新增抢购轮播图
     *
     * @param mallTimeBanner 抢购轮播图
     * @return 结果
     */
    @Override
    public int insertMallTimeBanner(MallTimeBanner mallTimeBanner)
    {
        mallTimeBanner.setCreateAt(new Date());
        return mallTimeBannerMapper.insertMallTimeBanner(mallTimeBanner);
    }

    /**
     * 修改抢购轮播图
     *
     * @param mallTimeBanner 抢购轮播图
     * @return 结果
     */
    @Override
    public int updateMallTimeBanner(MallTimeBanner mallTimeBanner)
    {
        mallTimeBanner.setUpdateAt(new Date());
        return mallTimeBannerMapper.updateMallTimeBanner(mallTimeBanner);
    }

    /**
     * 批量删除抢购轮播图
     *
     * @param ids 需要删除的抢购轮播图主键
     * @return 结果
     */
    @Override
    public int deleteMallTimeBannerByIds(Long[] ids)
    {
        return mallTimeBannerMapper.deleteMallTimeBannerByIds(ids);
    }

    /**
     * 删除抢购轮播图信息
     *
     * @param id 抢购轮播图主键
     * @return 结果
     */
    @Override
    public int deleteMallTimeBannerById(Long id)
    {
        return mallTimeBannerMapper.deleteMallTimeBannerById(id);
    }
}
